﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GrayParrot.Web.Controls
{
    public class FiltersComparer<T> : IEqualityComparer<T> where T : ColumnFilter
    {
        public bool Equals(T x, T y)
        {
            if (x.ColumnName != y.ColumnName)
                return false;
            else
                return true;
        }

        /// <summary>
        /// Returns a hash code for this instance.
        /// </summary>
        /// <param name="obj">The obj.</param>
        /// <returns>
        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. 
        /// </returns>
        public int GetHashCode(T obj)
        {
            return obj.GetType().GetHashCode();
        }
    }
}
